const momize=(fn)=>{
  const cache = {};
  return (...argument)=>{
     cache[JSON.stringify(argument)] = cache[JSON.stringify(argument)] || fn(...argument);
     return cache[JSON.stringify(argument)]
  }
}

const getSum = (r)=>{
  console.log(r)
  return Math.PI * r *r;
}

const dd = momize(getSum);

console.log(dd(3),dd(3),dd(3),dd(4),dd(4),dd(4),dd(4))